#include"graph.h"
#include<bits/stdc++.h>
#define fi first
#define se second
#define il inline
using namespace std;
#define ll long long
#define INT __int128
#define ld long double
#define pb emplace_back
#define lb(x) ((x)&-(x))
#define pii pair<int,int>
#define ull unsigned long long
#define TIME clock()*1.0/CLOCKS_PER_SEC
il int pc(int x){return __builtin_popcount(x);}
il int pc(ll x){return __builtin_popcountll(x);}
template<typename T> il void chkmin(T& x,T y){if(x>y)x=y;}
template<typename T> il void chkmax(T& x,T y){if(x<y)x=y;}
string bin(int x){return x<=1?(x?"1":"0"):bin(x>>1)+(x&1?"1":"0");}
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
#define rand(x,y) uniform_int_distribution<ll>(x,y)(rng)
#ifndef ONLINE_JUDGE
#define debug(x) (cerr<<#x<<": "<<x<<endl)
void __file(string s){freopen((s+".in").c_str(),"r",stdin),freopen((s+".out").c_str(),"w",stdout);}
#undef DEBUG
#define DEBUG cerr<<"Passing ["<<__FUNCTION__<<"] in LINE "<<__LINE__<<endl
#else
#define debug(x) 0
#define __file(s) 0
#define DEBUG 0
#endif
const ll P=998244353;
ll qpow(ll x,ll y=P-2){ll z=1;while(y){if(y&1)z=z*x%P;x=x*x%P,y>>=1;}return z;}

const int N=205;
vector<int> te[N],son[N];

int n,deg[N];
bool iste[N][N];int pid[N][N],eid[N][N];
const int pw[]={1,3,9,27,81,243,729};
int dis[N][N];
void dfs1(int x){
	deg[x]=NumberOfRoads();
	for(int i=1;i<=deg[x];i++){
		Move(i,2);
		if(Color()==2){
			Move(LastRoad(),2);
		}
		else{
			n++;
			te[x].pb(n),te[n].pb(x),son[x].pb(n);
			int lst=LastRoad();
			pid[x][i]=n,pid[n][lst]=x;
			eid[x][n]=i,eid[n][x]=lst;
			iste[x][i]=iste[n][lst]=1;
			dfs1(n);
			Move(lst,2);
		}
	}
}
int gd(int x,int d){return x/pw[d]%3;}
void col3(int x,int d){
	for(int i:son[x]){
		Move(eid[x][i],gd(x,d)+1);
		col3(i,d);
		Move(eid[i][x],gd(i,d)+1);
	}
}
void det(int x,int d){
	for(int i=1;i<=deg[x];i++){
		if(iste[x][i]) continue;
		Move(i,Color());
		pid[x][i]+=(Color()-1)*pw[d];
		Move(LastRoad(),Color());
	}
	for(int i:son[x]){
		Move(eid[x][i],Color());
		det(i,d);
		Move(eid[i][x],Color());
	}
}
void Inspect(int R){
	int i,j,k;
	dfs1(n=1);
	for(i=0;i<=4;i++) col3(1,i),det(1,i);
	memset(dis,0x1f,sizeof(dis));
	for(i=1;i<=n;i++) dis[i][i]=0;
	for(i=1;i<=n;i++){
		for(j=1;j<=deg[i];j++) dis[i][pid[i][j]]=1;
	}
	for(k=1;k<=n;k++) for(i=1;i<=n;i++) for(j=1;j<=n;j++) chkmin(dis[i][j],dis[i][k]+dis[k][j]);
	for(i=1;i<=R;i++){
		int cnt=0;for(j=1;j<=n;j++) for(k=j+1;k<=n;k++) cnt+=(dis[j][k]==i);
		Answer(i,cnt);
	}
}